#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
int n,k=114;
vector<int>e[100010];
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	freopen("road.in","r",stdin);
	freopen("road.out","w",stdout);
	cin >> n;
	n++;
	int tote=0;
	while(n!=1)
	{
		if(n&1)
		{
			e[1].push_back(k);
			tote++;
			n--;
		}
		n/=2;
		k--;
		tote+=2;
//		if(n==1)
//		{
//			e[1].push_back(k+1);
//			e[1].push_back(k+1);
//		}else{
//			e[k].push_back(k+1);
//			e[k].push_back(k+1);
//		}
	}
	cout << 114-k+1 << " " << tote << endl;
	int f=1;
	for ( int i = 113 ; i > k ; i-- )
	{
		cout << i << " " << i+1 << " " << 0 << endl;
		cout << i << " " << i+1 << " " << f << endl;
		f*=2;
	}
	cout << 1 << " " << k+1 << " " << 0 << endl;
	cout << 1 << " " << k+1 << " " << f << endl;
	f*=2;
	int mx=f-1;
	sort(e[1].begin(),e[1].end());
	for ( auto v:e[1] )
	{
		cout << 1 << " " << v << " " << mx+1 << endl;
		mx=mx+1+(1<<(114-v))-1;
	}
	return 0;
}
//100
